<?php
include_once("../config.php");
$uid=$_REQUEST['uid'];
//$id=$_REQUEST['id'];
$uid = str_ireplace($search, '', $uid);
$id=intval($_REQUEST['id']);
$data=$_REQUEST['data'];
$d = json_decode($data, true);
$zj=0;
foreach($d as $v){
	$dj = $v['sl'] * $v['dj'];
	$zj += round($dj, 2);
}


$sql = "select qianming from user where openid='$uid'";
$requ = mysqli_query($con,$sql);
$rs = mysqli_fetch_array($requ);
$gcsqm = $rs['qianming'];

$sql = "update wenti set wxxm='$data',wxzqm='$gcsqm',status=6,zj=$zj where id=$id and wxz='$uid'";
mysqli_query($con,$sql);
if(mysqli_affected_rows($con)){
	$result = '{"status":"1","msg":"ok"}';
}else{
	$result = '{"status":"-1","msg":"失败，请重试"}';
}
echo $result;


